---
title: 'Announcing Million 3'
date: FEB 2, 2024
description: Compiler overhaul, stability improvements, and the road ahead.
---

import Thumbnail from '../../public/v3-thumbnail.png';
import Image from "next/image"

<div className="flex justify-center mt-5">
  <Image src={Thumbnail} width="100%" />
</div>

<div className="flex flex-col items-center gap-4">

# Announcing Million 3

  <small>[AIDEN BAI](https://twitter.com/aidenybai), [NISARG PATEL](https://twitter.com/nisargptel), [JOHN YANG](https://twitter.com/fiveseveny) – FEB 2 2024</small>
</div>

---

After many months of development (_and one [soft launch](https://twitter.com/aidenybai/status/1732812329434423647) later_), we are **so excited** to finally release Million 3. Thousands of hours have gone into this release by the Million community, including the core team, contributors, and many Discord members who have helped us test and provide feedback.

## What is Million?

Million is an optimizing compiler for React. The React virtual DOM represents the user interface (UI) as a tree. Every time a component (node) renders, React traverses the virtual DOM tree to update the UI, resulting in `O(n)` time complexity. As your website grows, this can lead to sluggish user experiences.

Million takes a fundamentally different approach. It still represents a UI as a tree, but it discriminates between nodes. In an application, some nodes will never change (static text, images, etc.), while others will change frequently (user input, dynamic data, etc.). Instead of traversing every node, Million uses a compiler to directly update dynamic nodes, resulting in `O(1)` time complexity.

Since launching Million 1 & 2, we have found that this approach works exceptionally well for data-heavy UIs, like dashboard with real-time information. However, there were certain caveats – some common libraries were not compatible, non-deterministic returns could not be optimized, and the compiler was not as stable as we would like.

Million 3 is a signficant update that solves these issues. We believe that Million 3 is the best way to build React applications, and we are excited to share it with you.

<div className="mt-3 flex justify-center">
  <iframe
    width="560"
    height="315"
    src="https://www.youtube.com/embed/VkezQMb1DHw?si=dHe45lhM2uTOBQP9"
    title="YouTube video player"
    frameBorder="0"
    allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
    allowFullscreen
  ></iframe>
</div>

## What's new?

### Performance

The biggest challenge with Million 2 was hydration. In React, hydration is the process of attaching event listeners to the server-rendered HTML – making the page interactive. Just like how the virtual DOM needs to be traversed, hydration is also `O(n)` time complexity. This means that as your application grows, hydration can become a bottleneck.

```jsx 2-5
// Normally, React SSR will traverse every node in the component (👎 ❌)
<div>
  <h1>Hello, world!</h1>
  <button onClick={handleClick}>{count}</button>
</div>
```

In Million 3, we have introduced a new hydration system that only traverses the parts of the component that are dynamic, resulting in `O(d)` time complexity (where `d` is the number of dynamic nodes, `d` ≤ `n`).

```jsx /{count}/ /{handleClick}/
// Million 3 only hydrates `handleClick` and `count` (✨ ✅)
<div>
  <h1>Hello, world!</h1>
  <button onClick={handleClick}>{count}</button>
</div>
```

We are also currently working on removing `<slot>` elements. In Million 2, this was necessary to mount blocks and portals properly, but often resulted in extra memory overhead and issues with parent-dependent styling (such as `flex-box` or `grid`). We expect to ship a full revamp of this system in the next minor release.

### Stability

One of the major focuses of this release was to improve the stability of the developer experience.

Million 3 is a complete rewrite of the compiler. We have refactored based on correctness, to cover significantly more edge cases. These include: better TypeScript support, multiple returns, conditionals support, and handling of nested React components. This means that you can expect a more seamless and stable experience when using Million 3.

In the next few minor releases, we will be focusing on improving the performance of the compiler. This will make Million 3.x even faster and more reliable.

### Docs & i18n upgrade

The official [million.dev](https://million.dev) site has gotten an overhaul. We have added a new i18n system, so the site is now available in multiple languages! In addition, the documentation has been reorganized to show automatic mode as the default and manual mode as an advanced feature.

## Upgrading to version 3

Your current 2.x.x code should work with 3.x.x with no changes. To upgrade, simply run:

```bash
npx million@latest
```

That's all!

## The road ahead

In the coming weeks, the Million team will ship a suite of developer tools to redefine how frontend engineering teams approach <span className="underline decoration-wavy text-amber-500 decoration-amber-600">debugging</span>, fixing, and maintaining web performance. Our mission is to enable developers to deliver fast software effortlessly: with any system, on any platform.

Today, dealing with performance issues is a nightmare. The status quo is navigating through React Devtools, `Profiler`, Chrome Devtools, `why-did-you-render`, Forget, and the lot. This is a fundamentally broken experience, leading to some developers spending more time debugging rerenders than shipping features.

Even within the React ecosystem, there is a basic lack of understanding on how to enable developers to build and maintain fast applications. Frameworks like Next.js and Gatsby have made it easier to build performant websites, but they can't optimize inefficiently implemented code. Hosting services scale as your application grows, but they can't fix a poorly designed architecture.

We need to build tools that make it easy to deliver fast applications, regardless of the framework, platform, or the size of your engineering team.

At Million, we have a simple thesis for software performance – we can build tools that make _existing_ tooling fast and easy to use. Developers should think only of shipping features and fixing bugs – not keeping their apps fast. We plan to start with React, then extend to the roader frontend, backend, and other platforms.

I invite you to join Million on this journey. We are looking for talented frontend (dev tools) and pl/ml engineers to join us in the Bay Area. If you are interested, please email [aiden@million.dev](aiden@million.dev) with your resume and something you built using Million.

Let's make the future of software fast, together.

## Acknowledgements

Thank you to the many contributors who made this release possible. Special thanks to [@lxsmnsyc](https://twitter.com/lxsmnsyc), [@nisargptel](https://twitter.com/nisargptel), [@fiveseveny](https://twitter.com/fiveseveny), [@melindachang](https://github.com/melindachang) for their contributions to this release.

Feel free to ask questions and reach out to us on [Twitter](https://twitter.com/milliondotjs) or [GitHub](https://github.com/aidenybai/million).
